UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3j19hY0VSRV56KjCzrakRXJUiafPZCvlVqdtxNXVxO8=' 
WHERE 
  key_id = '517faf222d2f7d7974033a2696318bc6dbbc0b6ca8ca4655ed8bc55c391786a5' 
  AND (
    token = '3j19hY0VSRV56KjCzrakRXJUiafPZCvlVqdtxNXVxO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025