UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YqUBX134kSXR0DxU3HQI+axZm395m/yjJHAGf/vSFiQ=' 
WHERE 
  key_id = 'bb4740f57a61b77111bfe47fb4ee3e9b4c60e27b2d0881dc9a6256538567350e' 
  AND (
    token = 'YqUBX134kSXR0DxU3HQI+axZm395m/yjJHAGf/vSFiQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020