UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RuoZbU7dYJgmfvS03fLgUkRzIf5t91A0uWIB7njos4A=' 
WHERE 
  key_id = '2d327d0fe7427fafb0d0d1789fcecdd9f62eb12d472f64fc3370c60632865c22' 
  AND (
    token = 'RuoZbU7dYJgmfvS03fLgUkRzIf5t91A0uWIB7njos4A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032