UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eSYPlx7jK6DmymDwDnLsFNSu7WMDXqKKRwiUu2pwgKk=' 
WHERE 
  key_id = 'c13af40e002060ea837d272f87de78d3a3b4b2fd22e3a7ebab5cc2d5466a6bcd' 
  AND (
    token = 'eSYPlx7jK6DmymDwDnLsFNSu7WMDXqKKRwiUu2pwgKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040