UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o00Z4/N+NtkcJw9E91WiiwDzqYdUTEMjSG5LVYSZP+E=' 
WHERE 
  key_id = '21d27981363ef92479f437d52ee5546635b9ac320a15e9a0ec441cbbcff17b22' 
  AND (
    token = 'o00Z4/N+NtkcJw9E91WiiwDzqYdUTEMjSG5LVYSZP+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037