UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AYzTi2n6T6Tum156edtDjHyKt15aB5LSr2LNQqYK6wg=' 
WHERE 
  key_id = '90a0cd7c02ed16d7897e7be75a783bff01863dc637c84d3b946669563933b1d2' 
  AND (
    token = 'AYzTi2n6T6Tum156edtDjHyKt15aB5LSr2LNQqYK6wg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050