UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ITAdkKF1tI3SVu1DgpglhmQ9V6GZmpFJhzMEmNS8BBw='
WHERE
key_id = '76249e68f4c827c72e5516f8c4af134172275e74ee1e493d221c83e78a25accc'
AND (
token = 'ITAdkKF1tI3SVu1DgpglhmQ9V6GZmpFJhzMEmNS8BBw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)