UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'im7fc/zku4JdWDKQfUk146k0YcCsivp05sfL9RwP9tM='
WHERE
key_id = 'fa0386485171f0b2a75bdb51b22a68b17a916518f46895b91d25a166b964f2c3'
AND (
token = 'im7fc/zku4JdWDKQfUk146k0YcCsivp05sfL9RwP9tM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)