UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zJ4648NtclG/HIkWAuiJJAzgR/D2bUTbfaaQ+El04kk=' 
WHERE 
  key_id = '38b87d15e7f28bf7def0ed55c35f7ae8514e26822e70187ec71da191a672a539' 
  AND (
    token = 'zJ4648NtclG/HIkWAuiJJAzgR/D2bUTbfaaQ+El04kk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039