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