UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iXxE5MBT9y6Nul23pdDgiSsvs7YsUKY/nmUgD8vdUsY=' 
WHERE 
  key_id = 'bce72745765fa8963a7c5d60a71e3d907c55e1b21fbdbeccadf65a3aea40f7be' 
  AND (
    token = 'iXxE5MBT9y6Nul23pdDgiSsvs7YsUKY/nmUgD8vdUsY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026