UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '50lcXnbgYvmgU8xEnBQKolOKmJvJ8ZZfxsraehpdbLI='
WHERE
key_id = 'b8ca4f24add96f3a50e78c082d913f10a08abf7a36964b034b1518da3c20abd0'
AND (
token = '50lcXnbgYvmgU8xEnBQKolOKmJvJ8ZZfxsraehpdbLI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)