UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LKwqWybHVEY6XVQ5f4ubEFVXR9VwnPWltYXTFmNSloY=' 
WHERE 
  key_id = '7dad46be89a06c6db25ed99806f87677a43b351588eaef78c557d914e5ee5a2a' 
  AND (
    token = 'LKwqWybHVEY6XVQ5f4ubEFVXR9VwnPWltYXTFmNSloY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043