UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TrndBA5q4xOikYhxgks3+HqQAFlX52rE1F33ebfR3ks=' 
WHERE 
  key_id = 'a7b8872b010695e88ab62f55e22ddf94a30a76e4e9ddd1c416fd50735d117e61' 
  AND (
    token = 'TrndBA5q4xOikYhxgks3+HqQAFlX52rE1F33ebfR3ks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016