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

Query time 0.00026