UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XzURgGTI4r2aO7YXdWltdSFdomduUaTdNb9ciqbYU30='
WHERE
key_id = '1bc28947ebb6532d73647be451704f51f4af66eb0582346e66404a928849dcf7'
AND (
token = 'XzURgGTI4r2aO7YXdWltdSFdomduUaTdNb9ciqbYU30='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)