UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oHbtkCO+zrfcEr6McEXLn49rK/QmDjkpV+wRKVw1Sb4=' 
WHERE 
  key_id = 'e3059c0a3a380f0ecb8349a25aa392b792497b661afd10df6f7f05f3af8a570d' 
  AND (
    token = 'oHbtkCO+zrfcEr6McEXLn49rK/QmDjkpV+wRKVw1Sb4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028