UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vJgAoKH4SZvFh6JTE4cZKTmd5xWiHQIxIBnFVLENwbs='
WHERE
key_id = 'f3129225edb86e05bb554d0065e7b8d4cda4b17ff1ec214de358baf90f1bbf7e'
AND (
token = 'vJgAoKH4SZvFh6JTE4cZKTmd5xWiHQIxIBnFVLENwbs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)