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