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

Query time 0.00030