UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LwCvEt5GF1nVJeB+ojgK8ai7QjIisLRY3wohFZx7Als=' 
WHERE 
  key_id = 'a4c021a575815fc0a17d37774b0764f1e0f334b3d7744616cda8bc006e3f8cec' 
  AND (
    token = 'LwCvEt5GF1nVJeB+ojgK8ai7QjIisLRY3wohFZx7Als=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043