UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fYm0qodJdDJ4E/qTDRFQIlwBWSYESC7dzFsW/V46ys4='
WHERE
key_id = '790a0c1279f37807cb31c1abb2a2c73daad54857141d851a750ab925a107acc2'
AND (
token = 'fYm0qodJdDJ4E/qTDRFQIlwBWSYESC7dzFsW/V46ys4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)