UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mamjM0cx+UDl2COnhxbj0/thAPiozNyvSii8oYc7gR8='
WHERE
key_id = '582ac0348acbb258f4ea8158c506624269c006745736f4e45982b6325097b4a1'
AND (
token = 'mamjM0cx+UDl2COnhxbj0/thAPiozNyvSii8oYc7gR8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)