UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4HqNB1tFutJ5yajPANl3wEVsq0Q8Zy0j4dMGXYkkPlw='
WHERE
key_id = 'a133ebffa8e395f90c77d9bb9339202b92751852c6d0bd9665e5ba81f336f3df'
AND (
token = '4HqNB1tFutJ5yajPANl3wEVsq0Q8Zy0j4dMGXYkkPlw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)