UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8t6NtuhiSigXNthiT+ZP+E3XhofYQXVFlFpRf0pZkPA=' 
WHERE 
  key_id = 'c81ddf1a616800b1bebdee54320c45559467085db739e28992592d4d230f1aac' 
  AND (
    token = '8t6NtuhiSigXNthiT+ZP+E3XhofYQXVFlFpRf0pZkPA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027