UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GoVh+ye45bW2c9AzwT70U2xB6Y0p/n8t27dw47iMlbU=' 
WHERE 
  key_id = '477f61014d3f4135443eb48dcd2222bdd79e0c0e28ac7e67fda9ed6313fda806' 
  AND (
    token = 'GoVh+ye45bW2c9AzwT70U2xB6Y0p/n8t27dw47iMlbU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045