UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XGwDEehcmEkZZWF3e+821Na7Z0lV6h3D91qFVUubC64='
WHERE
key_id = '924ec2b7d54e9e724620378199afb0343da9f2812da6b2f09959d158c5605c7b'
AND (
token = 'XGwDEehcmEkZZWF3e+821Na7Z0lV6h3D91qFVUubC64='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)