UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nd46w9MNPwIjKD824g1Bq2wKc5Y6CHMxWN7WyhwKFrw='
WHERE
key_id = '0c663d478c2cacd583260b41bab4e25d813bc802ab679439af99033deb87f2aa'
AND (
token = 'nd46w9MNPwIjKD824g1Bq2wKc5Y6CHMxWN7WyhwKFrw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)