UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pI85aePS20bAciMj3TvvTGOpXwPkdksw3bGQTXbo6d0='
WHERE
key_id = 'd605035d1808e4ba6262cdf5df82f7709dea40f6c3c2484f3497afdeadb93aa5'
AND (
token = 'pI85aePS20bAciMj3TvvTGOpXwPkdksw3bGQTXbo6d0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)