UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'il9H9Mhf8eeXju0i2XAKgVyM77MX8pw0wIT6NdFseck=' 
WHERE 
  key_id = '8617e294a10b1f97a96c8a8c79815adf1a0652be4df766e80b01afeb03c2eeb9' 
  AND (
    token = 'il9H9Mhf8eeXju0i2XAKgVyM77MX8pw0wIT6NdFseck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025