UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RwkwhfSNbCD5R35xN9KhieUJF92IUkfSZwnoI9URPIA='
WHERE
key_id = '45a0b1babdea46e20eb107b21b4c322f247c08be8f566b18f6a149b89d16231d'
AND (
token = 'RwkwhfSNbCD5R35xN9KhieUJF92IUkfSZwnoI9URPIA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)