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

Query time 0.00046