UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cdRYOaejU7z+XtYWyFvputiuASx6ovxJhSaf8XA7tCk='
WHERE
key_id = '1a6cf696a449965e900a31ae81927b7cadec75576165c44a84b3932ef9bc49af'
AND (
token = 'cdRYOaejU7z+XtYWyFvputiuASx6ovxJhSaf8XA7tCk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)