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

Query time 0.00030