UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3SHT7a9uXl3Sg847SWX2sz0nnv+r63gY38Fm6Hz+4J8=' 
WHERE 
  key_id = '58259025fedb9632abbf07d383e7ad37c1a8aef023a3d9d440bd9c047e7e56f8' 
  AND (
    token = '3SHT7a9uXl3Sg847SWX2sz0nnv+r63gY38Fm6Hz+4J8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017