UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'INuaHaZ4Z5ovYZgo+j3OtvTFZZDQVX0RBE+B0+OmF9s=' 
WHERE 
  key_id = '0b9c7a4c825e13cfedcc37202b365b54a57520bebc5b75fc6ca5cd689e47687a' 
  AND (
    token = 'INuaHaZ4Z5ovYZgo+j3OtvTFZZDQVX0RBE+B0+OmF9s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055