UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8UopMUheyCoXgt8Q6qNcYwn872RmV1MFVeB0ocXmBYA='
WHERE
key_id = 'dd97a1f55c1165d67ae2fe3858c41bbb9864c9612eeac87abc535c25cb831833'
AND (
token = '8UopMUheyCoXgt8Q6qNcYwn872RmV1MFVeB0ocXmBYA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)