UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n6zaVdhg5XHT/ROUy2oHJDUDgGf1ZRaNjeDQTfyURD4=' 
WHERE 
  key_id = '834ca6ab4f44df4b376553ca377c262f77e03e2a9ceb64b20d841c2e0fd67559' 
  AND (
    token = 'n6zaVdhg5XHT/ROUy2oHJDUDgGf1ZRaNjeDQTfyURD4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023