UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wCnZUJLZ889vcAFSdCOLfhbSkj5iGeRyEf5FwC92+fc='
WHERE
key_id = 'bdad5d34bdb7497f6bed24b7c8b0af038b129c1c854502d08da12ee9b11382f3'
AND (
token = 'wCnZUJLZ889vcAFSdCOLfhbSkj5iGeRyEf5FwC92+fc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)