UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RrdY25AK7LKgoroYBVHyGLZNXJsg+hngNBjnHSYV2sk=' 
WHERE 
  key_id = '38aff52907f3c3a3902f8973665a5a0246910549d7d5ecacf16aa85f581daeeb' 
  AND (
    token = 'RrdY25AK7LKgoroYBVHyGLZNXJsg+hngNBjnHSYV2sk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026