UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+7gpo0dz82KyCcFM1vZok1bL/s8uToIwYwgNYFXJabA=' 
WHERE 
  key_id = 'c52d4a9c9e9c9c7e324b51887885e8831d6c9a2cd704018495acc0f9d7e69fbb' 
  AND (
    token = '+7gpo0dz82KyCcFM1vZok1bL/s8uToIwYwgNYFXJabA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048