UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qSEhYPGGJmLhQPJt/STAlW4jjvRu3hXvgZ2Mxd2+0tk='
WHERE
key_id = 'd21804c83fe5ff07cc8347a5a56d60f67bf1b32c5ce2749e6ca0c90dc8210858'
AND (
token = 'qSEhYPGGJmLhQPJt/STAlW4jjvRu3hXvgZ2Mxd2+0tk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)