UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OwmCRqJl9faaYqDKMFu7lEHEQfWsWVbFW2duCvFCfQU=' 
WHERE 
  key_id = '564bc8a07528570e156ed2852371e69578e836fe578e42170b7817a81785b79b' 
  AND (
    token = 'OwmCRqJl9faaYqDKMFu7lEHEQfWsWVbFW2duCvFCfQU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047