UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A3UGrIV/EUjWT496QITH8yaC4ZvW5HazTTBsbHnfB8M='
WHERE
key_id = '31ad0e9c4157025d6f0de2b38cde42c1b743c6d83e86fe271e0c906a042bc574'
AND (
token = 'A3UGrIV/EUjWT496QITH8yaC4ZvW5HazTTBsbHnfB8M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)