UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6DBAw2rpOK3Jlx3jtB9jiyyXa26o2RHaxppS6H9yKO8='
WHERE
key_id = '21bf51d62af22bce8ff217f9211ab2e10561d3064dc1f677266fe7357ced1489'
AND (
token = '6DBAw2rpOK3Jlx3jtB9jiyyXa26o2RHaxppS6H9yKO8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)