UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qp/atr8Kb8O1Qk2WnIZzN7VsuHapmsKAyZmFtKMCcs0=' 
WHERE 
  key_id = '87666db951c3ab6e84dfbec1949f5fd3971e642863c68aa92c389547dafeb4ad' 
  AND (
    token = 'qp/atr8Kb8O1Qk2WnIZzN7VsuHapmsKAyZmFtKMCcs0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032