UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KSCoNZpRycULHhM+qECi0M8CG0KmEHjiUPJJYpgM6J4='
WHERE
key_id = 'b67ac368335b6e058c915d15527280c9581134874a63ce2fdebeda2dc6158915'
AND (
token = 'KSCoNZpRycULHhM+qECi0M8CG0KmEHjiUPJJYpgM6J4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)