UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4EcrgzEU+MSiepvZssHUFohrkn1YAnu/x0f/TmNgrhU=' 
WHERE 
  key_id = '4ddb3bfe95e43062c5d928557193f70d9fb0c11673dd8e3c633ff35badb20891' 
  AND (
    token = '4EcrgzEU+MSiepvZssHUFohrkn1YAnu/x0f/TmNgrhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037