UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hx+P0gA9a3JJFdNfN4L5kUZvI1Hnhf+nH87aow3n2bc=' 
WHERE 
  key_id = '3d19617d99b517bc1a6bd762c658656b6e37cc2dbb0626da613e698fd839a42d' 
  AND (
    token = 'hx+P0gA9a3JJFdNfN4L5kUZvI1Hnhf+nH87aow3n2bc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034