UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xgIYii5+ooR2viGKetqyvf564iP8WDt3o7a7uKBWlvE=' 
WHERE 
  key_id = '5f8c5a76bbc16e9d050fce610dedf7f8f6d78bf1fbc6d264d18f55930d3096bc' 
  AND (
    token = 'xgIYii5+ooR2viGKetqyvf564iP8WDt3o7a7uKBWlvE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027