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