UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HGcr6zy0eTp5puBHiC2yrKa3StTeB6DQ7LUN44sakO0='
WHERE
key_id = 'b561a8839e77884d696526ca6f9e9e96ab4019f54a9b78eed44fbf42969916c0'
AND (
token = 'HGcr6zy0eTp5puBHiC2yrKa3StTeB6DQ7LUN44sakO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)