UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z5nYbvsU03Ruwc6pmxXZaNtHRec1P32aCwZElE7d0P4='
WHERE
key_id = '048130ff2adff72cab619b39c975bbbf2bb7ca96207bca1c5102645f508abc9e'
AND (
token = 'Z5nYbvsU03Ruwc6pmxXZaNtHRec1P32aCwZElE7d0P4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)