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

Query time 0.00025