UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cyfcUzcrje3ikF6HCkm/BmJbSha5vyT5KufQ9r7ejwE='
WHERE
key_id = 'd7e9e82b8b2837b786699128b9d8ff848fd0cecaf903dc913b182ff2d8fef2c4'
AND (
token = 'cyfcUzcrje3ikF6HCkm/BmJbSha5vyT5KufQ9r7ejwE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)