UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '638UBGuFsufrfMeEYtggirs8xZZxdiL5csJYNOiJl9M='
WHERE
key_id = '76edf64a4d96b656673de3c1e00df5bbe558cc958493fe4530009c811e2a94c9'
AND (
token = '638UBGuFsufrfMeEYtggirs8xZZxdiL5csJYNOiJl9M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)