UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D4w3zxqwbFIYJfBJqF9PWQ8rxwkirIBLwrzWcMfUYcc=' 
WHERE 
  key_id = '35fa85f7d68de584c3be84e550b950ef89345ef1bcbf137d660b088624e01ae2' 
  AND (
    token = 'D4w3zxqwbFIYJfBJqF9PWQ8rxwkirIBLwrzWcMfUYcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023